<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>计算阶层</title>
</head>
<body>
	  
	<script type="text/javascript">
        //计算10的阶层
        //规律
        //10! = 10 x9!
        //9! = 9 x8!
        //以此 类推
        //1！ = 1
        

        function jieceng(num){
        	if(num<=1){
               return 1;
        	}else{
        		return num*jieceng(num-1);
        	}
            
        }

        alert(jieceng(10));
        jieceng(10);


        function sum(number){
            if(number<=1){
            	return 1;
            }else{
            	return number * sum(number-1);
            }
        }

        sum(100);
        alert(sum(100));
       
	</script>
</body>
</html>